VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "ObjLine"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit

Public x1 As Single
Public y1 As Single
Public x2 As Single
Public y2 As Single

Function ObjectType() As String
    ObjectType = "LINE"
End Function


' ************************************************
' Compute the world coordinate bounds for the
' line.
' ************************************************
Sub Bound(xmin As Single, ymin As Single, xmax As Single, ymax As Single)
    If x1 < x2 Then
        xmin = x1
        xmax = x2
    Else
        xmin = x2
        xmax = x1
    End If
    If y1 < y2 Then
        ymin = y1
        ymax = y2
    Else
        ymin = y2
        ymax = y1
    End If
End Sub

' ************************************************
' Write a line to a file using Write.
' Begin with "LINE" to identify this object.
' ************************************************
Sub FileWrite(filenum As Integer)
    Write #filenum, "LINE", x1, y1, x2, y2
End Sub
' ************************************************
' Draw the line on a Form, Printer, or
' PictureBox.
' ************************************************
Sub Draw(canvas As Object)
    canvas.Line (x1, y1)-(x2, y2)
End Sub

' ************************************************
' Read a line from a file using Input.
' Assume the "LINE" label has already been read.
' ************************************************
Sub FileInput(filenum As Integer)
    Input #filenum, x1, y1, x2, y2
End Sub

